<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Parser Operators</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Spirit 2.5.8">
<link rel="up" href="../reference.html" title="Reference">
<link rel="prev" href="numeric/boolean.html" title="Boolean Parser (bool_)">
<link rel="next" href="operator/alternative.html" title="Alternative Parser (a | b)">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="numeric/boolean.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator/alternative.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="spirit.qi.reference.operator"></a><a class="link" href="operator.html" title="Parser Operators">Parser Operators</a>
</h4></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="operator/alternative.html">Alternative
          Parser (<code class="computeroutput"><span class="identifier">a</span> <span class="special">|</span>
          <span class="identifier">b</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/and_predicate.html">And-Predicate
          Parser (<code class="computeroutput"><span class="special">&amp;</span><span class="identifier">a</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/difference.html">Difference
          Parser (<code class="computeroutput"><span class="identifier">a</span> <span class="special">-</span>
          <span class="identifier">b</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/expect.html">Expectation
          Operator (<code class="computeroutput"><span class="identifier">a</span> <span class="special">&gt;</span>
          <span class="identifier">b</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/kleene.html">Kleene Parser
          (<code class="computeroutput"><span class="special">*</span><span class="identifier">a</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/list.html">List Parser (<code class="computeroutput"><span class="identifier">a</span> <span class="special">%</span> <span class="identifier">b</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/not_predicate.html">Not-Predicate
          Parser (<code class="computeroutput"><span class="special">!</span><span class="identifier">a</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/optional.html">Optional Parser
          (<code class="computeroutput"><span class="special">-</span><span class="identifier">a</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/permutation.html">Permutation
          Parser (<code class="computeroutput"><span class="identifier">a</span> <span class="special">^</span>
          <span class="identifier">b</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/plus.html">Plus Parser (<code class="computeroutput"><span class="special">+</span><span class="identifier">a</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/sequence.html">Sequence Parser
          (<code class="computeroutput"><span class="identifier">a</span> <span class="special">&gt;&gt;</span>
          <span class="identifier">b</span></code>)</a></span></dt>
<dt><span class="section"><a href="operator/sequential_or.html">Sequential
          Or Parser (<code class="computeroutput"><span class="identifier">a</span> <span class="special">||</span>
          <span class="identifier">b</span></code>)</a></span></dt>
</dl></div>
<p>
          Operators are used as a means for object composition and embedding. Simple
          parsers may be composed to form composites through operator overloading,
          crafted to approximate the syntax of <a class="link" href="../../abstracts/parsing_expression_grammar.html" title="Parsing Expression Grammar">Parsing
          Expression Grammar</a> (PEG). An expression such as:
        </p>
<pre class="programlisting"><span class="identifier">a</span> <span class="special">|</span> <span class="identifier">b</span>
</pre>
<p>
          yields a new parser type which is a composite of its operands, <code class="computeroutput"><span class="identifier">a</span></code> and <code class="computeroutput"><span class="identifier">b</span></code>.
        </p>
<p>
          This module includes different parsers which get instantiated if one of
          the overloaded operators is used with more primitive parser constructs.
          It includes Alternative (<code class="computeroutput"><span class="special">|</span></code>),
          And-predicate (unary <code class="computeroutput"><span class="special">&amp;</span></code>),
          Difference (<code class="computeroutput"><span class="special">-</span></code>), Expect (<code class="computeroutput"><span class="special">&gt;</span></code>), Kleene star (unary <code class="computeroutput"><span class="special">*</span></code>), Lists (<code class="computeroutput"><span class="special">%</span></code>),
          Not-predicate (<code class="computeroutput"><span class="special">!</span></code>), Optional
          (unary <code class="computeroutput"><span class="special">-</span></code>), Permutation (<code class="computeroutput"><span class="special">^</span></code>), Plus (unary <code class="computeroutput"><span class="special">+</span></code>),
          Sequence (<code class="computeroutput"><span class="special">&gt;&gt;</span></code>), and Sequential-Or
          (<code class="computeroutput"><span class="special">||</span></code>).
        </p>
<h6>
<a name="spirit.qi.reference.operator.h0"></a>
          <span class="phrase"><a name="spirit.qi.reference.operator.module_header"></a></span><a class="link" href="operator.html#spirit.qi.reference.operator.module_header">Module
          Header</a>
        </h6>
<pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/home/qi/operator.hpp&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_operator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<p>
          Also, see <a class="link" href="../../structure/include.html" title="Include">Include Structure</a>.
        </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="numeric/boolean.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator/alternative.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
